package com.foxconn.AppDownload.util;

import com.foxconn.AppDownload.domain.ZxingLogoConfig;
import com.google.zxing.BarcodeFormat;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
 * @author zengdong
 * @version 1.0
 * @date 2023/12/18 13:48
 */
public class test {

    public static void main(String[] args) {

        String url = "https://txz.foxconn.com:8080/app-platform/itapp/iFoxSmartFactory.apk";
        int size = 300;

        //使用方式
        ZXingCode zp =  ZXingCode.getInstance();
        BufferedImage bim = zp.getQRCODEBufferedImage(url, BarcodeFormat.QR_CODE, size, size,
                zp.getDecodeHintType());
        //ImageIO.write(bim, "png", response.getOutputStream());

        //如果是只要生成到本地文件夹 用以下写法
        File file=new File("src/main/webapp/image/QRCode/qrcode-login.png");
        File logo=new File("src/main/webapp/image/icon/logo.jpg");
        BufferedImage aim = zp.addLogoQRCode(bim, logo, new ZxingLogoConfig());
        try {
            ImageIO.write(aim, "png", file);
        } catch (IOException e) {
            e.printStackTrace();
        }


    }

}
